/*
 * @(#)MaintDmsRelationalWordAction.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.dms.web;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.dcivision.dms.dao.DmsSearchRelationalWordDAObject;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.SystemFunctionConstant;
import com.dcivision.framework.web.AbstractActionForm;
import com.dcivision.framework.web.AbstractListAction;
import com.dcivision.framework.web.AbstractSearchForm;

/**
 * <p>Class Name:       MaintDmsRelationalWordAction.java    </p>
 * <p>Description:</p>
 * @author              weison liang
 * @company             DCIVision Limited
 * @creation date       03/09/2004
 * @version             $Revision: 1.5 $
 */

public class MaintDmsSearchRelationalWordAction extends AbstractListAction{

  public static final String REVISION = "$Revision: 1.5 $";


  public  MaintDmsSearchRelationalWordAction(){
    super();
    this.setListName("dmsRelationalWordList");
  }
   /**
   * getMajorDAOClassName
   *
   * @return  The class name of the major DAObject will be used in this action.
   */
  public String getMajorDAOClassName() {
    return ("com.dcivision.dms.dao.DmsSearchRelationalWordDAObject");
  }
  /**
   * getFunctionCode
   *
   * @return  The corresponding system function code of action.
   */
  public String getFunctionCode() {
    return (SystemFunctionConstant.DMS_ADMIN);
  }
  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException {
    MaintDmsSearchRelationalWordForm maintForm=(MaintDmsSearchRelationalWordForm)form;
    String opMode=maintForm.getOpMode();
    String navMode=maintForm.getNavMode();
    return super.execute(mapping,form,request,response);

 }
  
  
  public void insertRecord(ActionMapping mapping, AbstractActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException {
    
     
     
  }
  public void updateRecord(ActionMapping mapping, AbstractActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException {
   
  } 
  public void deleteListData(ActionMapping mapping, AbstractSearchForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException {
    MaintDmsSearchRelationalWordForm searchRelationalWordForm = (MaintDmsSearchRelationalWordForm)form;
    Integer ID=null;
    String [] BasicSelectedID = form.getBasicSelectedID();
    if(BasicSelectedID.length==0){
      ID=new Integer(BasicSelectedID[0]);
      DmsSearchRelationalWordDAObject dmsSearchRelationalWord = new DmsSearchRelationalWordDAObject(this.getSessionContainer(request), this.getConnection(request));
        
        dmsSearchRelationalWord.deleteByKeyWord(ID);
    }else{
      for(int i=0;i<BasicSelectedID.length;i++){
        ID=new Integer(BasicSelectedID[i]);
        DmsSearchRelationalWordDAObject dmsSearchRelationalWord = new DmsSearchRelationalWordDAObject(this.getSessionContainer(request), this.getConnection(request));
        if (dmsSearchRelationalWord.getNumberOfRelationWord(ID).intValue() > 0){
        	dmsSearchRelationalWord.deleteByKeyWord(ID);
        }
      }
    }
    
    super.deleteListData(mapping, form, request, response);
   } 
}
